<%--
  Created by IntelliJ IDEA.
  User: 三斤
  Date: 2022/11/24
  Time: 20:14
  To change this template use File | Settings | File Templates.
--%>

<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.Statement" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>球队</title>
    <head>
        <title>游客查看界面</title>
        <style type="text/css">
            body{
                margin:0 auto;
                background-color:#FFF;
                font-size:12px;
            }s'x
            h1{font-family: "楷体";}
            .top,.center {
                height: 50%;
                width: 100%;
            }
            .right{
                width: 44px;
                height: 300px;
                float:right;
            }
            .left{

                width: 35%;
                height: 50%;
                float:left;
            }
            #left {
                width: 30%;
                float: left;
                padding: 0 10px;
                height: auto;
            }
            #right {
                width: 50%;
                float: right;
                height: auto;
                padding-top: 30px;
            }
        </style>
    </head>
<body>
<!DOCTYPE html>
<html lang="zh-CN">
<img class="top" src="4.png" style="height:50%;">
<h1 style="margin: -5px;"></h1>
<div class="center">
    <div id="left" style="background:url('5.png') no-repeat;width: 40%;height: 700px;">
        <ul>
            <li>
                <h1>2022卡塔尔世界杯</h1>
        </ul>
    </div>
    <div id="right">
        <p><a href="index.jsp"><h2>首页</h2></a></p>
        <jsp:useBean id="DB" class="db.conn" />
        <table align="center" border bordercolor="#0099ff">
            <tr>
                <th>国家队</th>
                <th>得票数</th>
            </tr>
            <%
                int totalNum =0;
                Connection conn = DB.getConn();
                Statement stmt = DB.getStatement(conn);
                ResultSet rs = DB.getResultSet(stmt,"select count from vote");
                while(rs.next()){
                    totalNum += rs.getInt(1);
                }
                DB.close(rs);
                rs = DB.getResultSet(stmt,"select * from vote");
                while (rs.next()){
                    out.println("<tr>");
                    int num = rs.getInt("count");
                    out.println("<td>"+rs.getString("item")+"</td>");
                    out.println("<td>得:"+num+"票</td>");
                }
                DB.close(conn);
                DB.close(stmt);
                DB.close(rs);
            %>
        </table>
        <p align="center"><a href="deng_lu.jsp"><h2>快去登录投票吧</h2></a></p>
    </div>
</div>
</body>
</html>